<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>记录查询</title>

    <link href="<c:url value="/static/css/bootstrap.css"/>" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="<c:url value="/static/jquery/jquery-1.9.1.min.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/static/angular/angular.min.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/static/ngservice/urlinterceptor.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/static/ngservice/baseHttp.js"/>"></script>
    <script type="text/javascript" src="<c:url value="/static/ngfilter/filter.js"/>"></script>

    <script>
        angular.module("landlordApp", ["baseHttp","filters"])
                .config(function (httpUrlInterceptorProvider) {
                    httpUrlInterceptorProvider.setContextPath("${ctx}");//设置项目ContextPath
                })
                .run(function ($rootScope, baseHttp) {
                    //加载数据
                    baseHttp.get("landlord/findAll").then(function (data) {

                        $rootScope.landlordList = data;
                    });
                })
                .controller("landlordController", function ($scope,baseHttp) {
                    $scope.condition = {};

                    $scope.query = function(){
                        baseHttp.post("landlord/findAll",$scope.condition).then(function(data){
                            $scope.landlordList = data;
                        });
                    };
                });
    </script>
</head>
<body ng-app="landlordApp">

<div class="panel panel-default" ng-controller="landlordController">
    <!-- Default panel contents -->
    <div class="panel-heading">记录查询</div>
    <div class="panel-body">
        <form class="form-inline">
            <div class="form-group">
                <label for="name">姓名</label>
                <input type="text" class="form-control" id="name" ng-model="condition.name">
            </div>
            <div class="form-group">
                <label for="mobileNo">手机号</label>
                <input class="form-control" id="mobileNo" ng-model="condition.mobileNo">
            </div>
            <div class="form-group">
                <label for="idNo">身份证号</label>
                <input class="form-control" id="idNo" ng-model="condition.idNo">
            </div>
            <button type="submit" class="btn btn-default" ng-click="query()">查询</button>
        </form>
    </div>

    <!-- Table -->
    <table class="table">
        <thead>
        <tr>
            <th>姓名</th>
            <th>手机号</th>
            <th>身份证号</th>
            <th>出租套数</th>
            <th>合计租金</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-repeat="item in landlordList">
            <td>{{item.name}}</td>
            <td>{{item.mobileNo}}</td>
            <td>{{item.idNo}}</td>
            <td>{{item.num}}</td>
            <td>{{item.rent}}</td>
        </tr>
        </tbody>
    </table>
</div>

</body>
</html>
